home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / pwrclib.exe / 4350EVGA.C < prev    next >
C/C++ Source or Header  |  1992-12-21  |  2KB  |  93 lines

  1. /* 43/50 line screen mode functions */
  2.  
  3. #include <dos.h>
  4. #include "video.h"
  5.  
  6. #define CGASIZE 24     /* bottom line, CGA/normal text screen */
  7. #define EGASIZE 42     /* bottom line, EGA extended text screen */
  8. #define VGASIZE 49     /* bottom line, VGA extended text screen */
  9. #define VIDEO() int86(0x10,®s,®s)
  10. #define FALSE 0
  11. #define TRUE 1
  12.  
  13.  
  14.  
  15.   
  16. int ext_screen(int video_card)  /* set 43-line (EGA) or 50-line (VGA) text */
  17.  
  18. {
  19.     /* Local variables */
  20.     union REGS regs;
  21.     
  22.     int screen_size;
  23.     
  24.     switch(video_card){
  25.         case EGA_CARD: {
  26.             screen_size=EGASIZE;
  27.         }
  28.             break;
  29.         case VGA_CARD: {
  30.             screen_size=VGASIZE;
  31.         }
  32.         break;
  33.         default: {
  34.                  screen_size=CGASIZE; 
  35.             return screen_size;
  36.         }
  37.     }
  38.   
  39.     regs.x.ax=0x1112;             /* load 8x8 font */
  40.     regs.h.bl=0x00;
  41.   
  42.     VIDEO();
  43.   
  44.     regs.x.cx=0x0600;             /* set cursor size */
  45.     regs.h.ah=0x01;
  46.   
  47.     VIDEO();
  48.   
  49.     outp(0x03b4, 0x0714);         /* fix up underline */
  50.   
  51.     return screen_size;
  52.     
  53. }
  54.  
  55.  
  56.  
  57.  
  58. int normal_screen(video_card)  /* restore 25-line text */
  59.  
  60. {
  61.     /* Local variables */
  62.     union REGS regs;
  63.     
  64.     int screen_size;
  65.  
  66.     if(video_card!=MDA_CARD){         /* if not in monochrome mode */
  67.         regs.x.ax=0x0003;
  68.         VIDEO();
  69.     }
  70.   
  71.     screen_size=CGASIZE;
  72.   
  73.     return screen_size;
  74.     
  75. }
  76.  
  77.  
  78.  
  79.  
  80. int screen_lines()  /* Read current screen line setting */
  81.  
  82. {
  83.     /* Local variables */
  84.     int lines;
  85.     
  86.     lines=peekb(0x40,0x84);
  87.     
  88.     if (lines==0)
  89.         lines=24;
  90.     
  91.     return (lines+1);
  92. }
  93.